module("queue",package.seeall)
Data["config/cmdlimit"]=35
Data["queue/available"]=Data["config/cmdlimit"]
Data["queue/list"]={}
  on_tick=function()
   Data["queue/available"]=Data["config/cmdlimit"]  
   exec()
 end
 events.bind("tick",on_tick)
 exec=function()
    cmds=Data["queue/list"][1]
    while cmds do
      cmdlen=table.getn(cmds)
      if cmdlen<Data["queue/available"] then
	table.remove(Data["queue/list"],1)
	Send( table.concat(cmds,"\n"))
	Data["queue/available"]=Data["queue/available"]-cmdlen
	cmds=Data["queue/list"][1]
      else
	cmds=nil
      end
    end
 end
 add=function(cmds)
   table.insert(Data["queue/list"],cmds)
   exec()
 end
 run=function()
 end
 
tickpluginid="cc541cf534fb864555f4cfba"
tickplugin=function(enable)
	if not IsPluginInstalled(tickpluginid) then
		LoadPlugin("lua\\luamudbot\\mods\\hell\\tick.xml")
	end
	if enable~= false then enable = true end
	EnablePlugin(tickpluginid,enable)
end 
tickplugin(true)
